Multiply-add operations of binary numbers in an arithmetic unit

ABSTRACT

Disclosed herein is a computer implemented method for performing multiply-add operations of binary numbers P, Q, R, S, B in an arithmetic unit of a processor, the operation calculating a result as an accumulated sum, which equals to B+n×P×Q+m×R×S, where n and m are natural numbers. Further disclosed herein is an arithmetic unit configured to implement multiply-add operations of binary numbers P, Q, R, S, B comprising at least a first binary arithmetic unit for calculating an aligned high part result and a second binary arithmetic unit for calculating an aligned low part result of the multiply-add operations.

The present disclosure relates in general to data processing systems, inparticular, to a computer implemented method, an arithmetic unit, asystem and a computer program product for performing multiply-addoperations of binary numbers A, B, C in an arithmetic unit of aprocessor.

BACKGROUND

To improve arithmetic processing most modern processors use a processcalled the fused-multiply-add (in the following abbreviated as FMA)process to combine a multiplication operation, e.g., A×C, and anaddition operation, e.g., +B, for execution as a single instruction,e.g., A×C+B, where A, B, C are operands of the multiplication productA×C and the sum of B and the product. By performing two operations in asingle instruction, the FMA process reduces overall execution time.

A number of widely used crypto algorithms are based on one or many longinteger multiply instructions (e.g. 256 or 2048 bits). These are e.g.used when establishing a secure connection or for blockchains. Forperformance reasons these algorithms should be as fast and efficient aspossible. New algorithms that are quantum computers resistant arearising like elliptic curve cryptography (ECC) which might also requirefast throughput and will become soon the new standard and be widelyused. These new algorithms, in order to be quantum resistant, do notrely on basic long multiplications, but also shifts of intermediateresults as characteristic. Therefore an efficient and fastimplementation of multiplication operations is needed for those newalgorithms.

SUMMARY

A computer implemented method for performing multiply-add operations ofbinary numbers P, Q, R, S, B in an arithmetic unit of a processor isproposed. The operation is calculating a result as an accumulated sum,which equals to B+n×P×Q+m×R×S, where n and m are natural numbers, themethod comprising the calculation steps for obtaining a result of theoperation: (i) generating a shifted high part B′_(HIGH) of the addend Bby performing a right shift of the high part B_(HIGH) of the addend B byn bits; (ii) generating a shifted first intermediate result bygenerating the multiplication product P×Q and adding the shifted highpart B′_(HIGH); (iii) generating a first intermediate result byperforming a left shift of the shifted first intermediate result by nbits; (iv) generating a shifted low part B′_(LOW) of the addend B byperforming a right shift of the low part B_(L)O_(W) of the addend B by mbits; (v) generating a shifted second intermediate result by generatingthe multiplication product R×S and adding the shifted low part B′_(LOW);(vi) generating a second intermediate result by performing a left shiftof the shifted second intermediate result by m bits; and (vii)determining the accumulated sum as the result of the multiply-addoperations by adding the first intermediate result to the secondintermediate result.

The natural numbers n, m are advantageously in the range of {1, 2}, butin advantageous embodiments might even be higher. Due to an advantageousembodiment the binary number P may represent a high part of amultiplicand A and the binary number Q may represent a high part of amultiplicand C, whereas the binary number R may represent a low part ofa multiplicand A and the binary number S may represent a low part of amultiplicand C of a multiply-add operation.

In particular, due to a present disclosure embodiment, the multiply-addoperations of binary numbers may be implemented as twomultiply-shift-add operations of binary numbers.

A vector multiply shift logic (VMSL) instruction may be implemented inarithmetic units to speed up long multiply instructions. Such algorithmsmay be based on an accumulated sum calculated by a multiply-addoperation:

B+=P×Q+R×S, where P, Q, R, S, B are binary numbers, and +=means anaddition calculating an accumulated sum.

As used herein, a multiply-add operation is a concatenated operationusing addition operations and multiply operations.

Special algorithms, e.g. used in elliptic curve cryptography (ECC) mayhave additional requirements for the long multiply instructions:

-   B+=n×P×Q+m×R×S with n, m being natural numbers and n, m being 1 or    2.

A typical code would not be able to take advantage of amultiply-shift-add instruction as the products may nor may not bemultiplied by two before being accumulated. Hence an implementation ofECC algorithm with state of the art multiply-shift-add instruction wouldhave less than half the performance of the present disclosure.

Therefore advantageously an enhanced VMSL with shift support and noruntime overhead is proposed, comprising an instruction based on:

-   B+=n×P×Q+m×R×S with n, m being natural numbers. The numbers n, m may    e.g. be 1 or 2, but higher natural numbers might be advantageous.

For performing the multiply-add operations the addend B is shifted for anumber of n bits and then added to the product of the multiplicationoperands. Then the intermediate result is shifted back for the sameamount of n bits. These operations may be performed in parallel on asingle instruction, multiple data (SIMD) unit but is not limited to.Finally the two intermediate results are then combined in order to getthe final result by adding the two high parts of the intermediateresults and the two low parts of the intermediate results.

Advantageously the multiply-add operations may be implemented on anarithmetic unit comprising at least two binary arithmetic units. Thenthe shift operation may be implemented in a way that it does not affectthe critical path through the unit as used for floating point numbers asno rounding and normalization is required.

According to a favourable embodiment of the disclosure the operation isperformed on an integer arithmetic for two independent parts. Thereforetwo independent multiplication products are calculated. The shiftoperation is performed on the addend B and not on the multiplicationproduct P×Q or R×S.

As used herein, the high part of a binary number is meaning the halfpart of the number with the most significant bits and the low part of abinary number is meaning the half part of the number with the leastsignificant bits.

The shift operation is advantageously performed on the adder side andnot on the side of the multiplier or rounder, because an add operationis performed much faster than a multiply operation. This means that theshift of the addend and the shift back of the addend are not critical intime. Shifting of the addend may be performed by e.g. 1 bit or 2 bit,yet higher multiplication numbers, like 4 for 3 bit shifting, might beappropriate too.

Advantageously the calculation of the high parts of the sum and the lowparts may be performed in a serial or parallel path. A parallel path mayhave an additional advantage concerning timing of the whole multiply-addoperation.

An existing guard bit logic in the arithmetic unit used forfloating-point rounding may be reused for performing the multiply-addoperations.

Advantageously the proposed enhanced VMSL may be implemented in apipelined processor structure.

Further an arithmetic unit is proposed, being configured to implement amultiply-add operations of binary numbers P, Q, R, S, B, the operationcalculating a result as an accumulated sum, which equals toB+n×P×Q+m×R×S, where n and m are natural numbers, comprising at least afirst binary arithmetic unit for calculating an aligned high part resultand a second binary arithmetic unit for calculating an aligned low partresult of the multiply-add operation, each arithmetic unit comprising atleast: (i) a multiplier connected to the dataflow for the high part P, Qor the low part R, S of the multiplication operands A, C and configuredto compute a product of the high parts or a product of the low parts ofthe multiplication operands A and C; (ii) a right shifter connected tothe dataflow of a high part B_(HIGH) or a low part B_(LOW) of the addendoperand B, being configured to deliver a shifted high part B′_(HIGH) orshifted low part B′_(LOW) of the addend operand B; (iii) a first adderconnected to an output of the multiplier and an output of the rightshifter, being configured to deliver a shifted first intermediate resultor a shifted second intermediate result; (iv) a left shifter connectedto an output of the first adder, being configured to deliver a first orsecond intermediate result; (v) a second adder connected to an output ofthe left shifter of one arithmetic unit and to an output of a leftshifter of the other arithmetic unit, wherein a carry-output of thesecond adder of the second arithmetic unit is connected to an input ofthe second adder of the first arithmetic unit; (vi) a normalizing androunding unit connected to an output of the left shifter and a selectcircuit connected to outputs of the second adder and to outputs of thenormalizing and rounding unit for delivering an aligned high part resultor an aligned low part result. The natural numbers n, m areadvantageously in the range of {1, 2}.

The proposed arithmetic unit comprising at least two binary arithmeticunits may be intended for executing a multiply-add operation of binarynumbers A, B, C according to the method described above.

As used herein, a shifter may be implemented as a shifter circuit, anadder as an adder circuit and a counter as a counter circuit.

Due to a further aspect, a data processing system for performingmultiply-add operations of binary numbers P, Q, R, S, B is proposed, theoperation using high parts P, Q and low parts R, S of multiplicationoperands A and C for calculating a result as an accumulated sum, whichequals to B+n×P×Q+m×R×S, where n and m are natural numbers, the systemcomprising at least one arithmetic unit as described above.

Further, a favourable computer program product is proposed forperforming multiply-add operations of binary numbers P, Q, R, S, B in anarithmetic unit of a processor is proposed, the operation calculating aresult as an accumulated sum, which equals to B+n×P×Q+m×R×S, where n andm are natural numbers. The computer program product is comprising acomputer readable storage medium having program instructions embodiedtherewith, the program instructions executable by the computer systemsto cause the computer systems to perform a method comprising thecalculation steps for obtaining a result of the operation: (i)generating a shifted high part B′_(HIGH) of the addend B by performing aright shift of the high part B _(HIGH) of the addend B by n bits; (ii)generating a shifted first intermediate result by generating themultiplication product P×Q and adding the shifted high part B′_(HIGH);(iii) generating a first intermediate result by performing a left shiftof the shifted first intermediate result by n bits; (iv) generating ashifted low part B′_(LOW) of the addend B by performing a right shift ofthe low part B_(LOW) of the addend B by m bits; (v) generating a shiftedsecond intermediate result by generating the multiplication product R×Sand adding the shifted low part B′_(LOW); (vi) generating a secondintermediate result by performing a left shift of the shifted secondintermediate result by m bits; and (vii) determining the accumulated sumas the result of the multiply-add operation by adding the firstintermediate result to the second intermediate result. The naturalnumbers n, m are advantageously in the range of {1, 2}.

BRIEF DESCRIPTION OF THE DRAWINGS

The present disclosure together with the above-mentioned and otherobjects and advantages may best be understood from the followingdetailed description of the embodiments, but not restricted to theembodiments.

FIG. 1 depicts a data flow of a computer implemented method forperforming multiply-add operations of binary numbers P, Q, R, S, B in anarithmetic unit of a processor according to an embodiment of thedisclosure.

FIG. 2 depicts a flowchart of the data flow for calculating the highparts and the low parts of the binary numbers in a serial implementationaccording to an embodiment of the disclosure.

FIG. 3 depicts a flowchart of the data flow for calculating the highparts and the low parts of the binary numbers in a parallelimplementation according to a further embodiment of the disclosure.

FIG. 4 depicts an example embodiment of an arithmetic unit beingconfigured to implement multiply-add operations of binary numbers P, Q,R, S, B according to an embodiment of the disclosure.

FIG. 5 depicts an example embodiment of a data processing system forexecuting a method according to the disclosure.

DETAILED DESCRIPTION

In the drawings, like elements are referred to with equal referencenumerals. The drawings are merely schematic representations, notintended to portray specific parameters of the disclosure. Moreover, thedrawings are intended to depict only typical embodiments of thedisclosure and therefore should not be considered as limiting the scopeof the disclosure.

The illustrative embodiments described herein provide a method,arithmetic unit, data processing system and computer program product forperforming multiply-add operations of binary numbers P, Q, R, S, B in anarithmetic unit of a processor. The illustrative embodiments aresometimes described herein using particular technologies only as anexample for the clarity of the description.

The illustrative embodiments may be used for a computer implementedmethod for performing multiply-add operations of binary numbers P, Q, R,S, B in an arithmetic unit of a processor, the operation calculating aresult as an accumulated sum, which equals to B+n×P×Q+m×R×S, where n andm are natural numbers.

Due to an advantageous embodiment the binary number P may represent ahigh part of a multiplicand A and the binary number Q may represent ahigh part of a multiplicand C, whereas the binary number R may representa low part of a multiplicand A and the binary number S may represent alow part of a multiplicand C of a multiply-add operation.

FIG. 1 depicts a data flow of a computer implemented method forperforming multiply-add operations of binary numbers P, Q, R, S, B in anarithmetic unit of a processor according to an embodiment of thedisclosure.

According to the present disclosure, the operation uses high parts P, Qand low parts R, S of multiplication operands A and C for calculating aresult as an accumulated sum. The result then equals to B+n×P×Q+m×R×S,where n and m are natural numbers. In a first calculation step a shiftedhigh part B′_(HIGH) 56 of the addend B is generated by performing aright shift of the high part B_(HIGH) 52 of the addend B by n bits. Theright shift is indicated by arrow 64 as a division by n. Next a shiftedfirst intermediate result 60 is generated by generating themultiplication product P×Q 58 and adding the shifted high part B′_(HIGH)56. Then a first intermediate result 62 is generated by performing aleft shift of the shifted first intermediate result 60 by n bits. Theleft shift is indicated by arrow 66 as a multiplication by n.

In the same way a shifted low part B′_(LOW) 76 of the addend B isgenerated by performing a right shift of the low part B_(LOW) 72 of theaddend B by m bits. The right shift is indicated by arrow 84 as adivision by m. A shifted second intermediate result 80 is generated bygenerating the multiplication product R×S 74 and adding the shifted lowpart B′_(LOW) 76. A second intermediate result 82 is generated byperforming a left shift of the shifted second intermediate result 80 bym bits. The left shift is indicated by arrow 86 as a multiplication bym. Then the accumulated sum may be determined as the result of themultiply-add operation by adding the first intermediate result 62 to thesecond intermediate result 82.

The natural numbers n and m may be 1 or 2. For other calculations alsohigher natural numbers may be appropriate.

An existing guard bit logic of the arithmetic unit used for rounding,may be reused, in the case when m equals to 2, the shifted secondintermediate result 82 may be rounded by the guard bit logic.

FIG. 2 depicts a flowchart of the data flow for calculating the highparts and the low parts of the binary numbers in a serial implementationaccording to an embodiment of the disclosure.

Performing the multiply-add operations of binary numbers P, Q, R, S, Baccording to the present disclosure the calculation of the accumulatedsum may also be expressed like (B_(HIGH), B_(LOW))+2^(g)×P×Q+2^(h)×R×S,where the exponents g and h may be natural numbers, e.g. 0 or 1 or evenhigher, with n=2^(g) and m=2^(h). In this expression the shifting of themultiplication operands is expressed by multiplication with 2^(g) and2^(h), being the mathematical notation for the shifting operation.

In step S100 the shifted high part B′_(HIGH) of the addend B isgenerated by performing a right shift (indicated by arrows) of the highpart B_(HIGH) of the addend B by n bits. Next in step S102 a shiftedfirst intermediate result INT_RES_(one) is generated by generating themultiplication product P×Q and adding the shifted high part B′_(HIGH).Then in step S104 a first intermediate result INT_RES′_(one) generatedby performing a left shift of the shifted first intermediate result by nbits, indicated by arrows.

In step S106 a shifted low part B′_(LOW) of the addend B is generated byperforming a right shift of the low part B_(LOW) of the addend B by mbits. In step S108 a shifted second intermediate result INT_RES_(two) isgenerated by generating the multiplication product R×S and adding theshifted low part B′_(LOW). Next in step S110 a second intermediateresult INT_RES′_(two) is generated by performing a left shift of theshifted second intermediate result by m bits. Then in step S112 theaccumulated sum may be determined as the result of the multiply-addoperation by adding the first intermediate result INT_RES′_(one) thesecond intermediate result INT_RES′_(two).

FIG. 3 depicts a flowchart of the data flow for calculating the highparts and the low parts of the binary numbers in a parallelimplementation according to a further embodiment of the disclosure.

In FIG. 3 the data flow is changed in such a way that the steps S200,S202, S204 for determining the shifted high part B′_(HIGH) of the addendB, generating the shifted first intermediate result INT_RES_(one) andgenerating the first intermediate result INT_RES′_(one) are performed inparallel to steps S206, S208, S210 for determining the shifted low partB′_(LOW) of the addend B, generating the shifted second intermediateresult INT_RES_(two) and generating the second intermediate resultINT_RES′_(two). Then in step S212 the accumulated sum is determined aswith the embodiment in FIG. 3 by adding the first intermediate resultINT^(—)RES′_(one) to the second intermediate result INT_RES′_(two).

FIG. 4 depicts an example embodiment of an arithmetic unit 10 beingconfigured to implement multiply-add operations of binary numbers P, Q,R, S, B according to an embodiment of the disclosure and according tothe method depicted in the data flow in FIG. 1.

The arithmetic unit 10 is configured to use high parts P 50, Q 54 andlow parts R 70, S 74 of the multiplication operands A and C forcalculating a result 90 as an accumulated sum, which equals toB+n×P×Q+m×R×S, where n and m are natural numbers. The numbers n, m maybe, according to a first embodiment, 1 or 2, but may also be highernatural numbers, e.g. 4 or other power-of-two numbers.

The arithmetic unit 10 comprises a first binary arithmetic unit 12 forcalculating an aligned high part result 92 and a second binaryarithmetic unit 32 for calculating an aligned low part result 94 of themultiply-add operation. Each arithmetic unit 12, 14 comprises amultiplier 14, 34 connected to the dataflow for the high part P 50, Q 54or the low part R 70, S 74 of the multiplication operands A, C. Themultiplier 14, 34 is configured to compute a product of the high parts58 or a product of the low parts 78 of the multiplication operands A andC. The arithmetic unit 10 further comprises a right shifter 24, 44connected to the dataflow of a high part B_(HIGH) 52 or a low partB_(LOW) 72 of the addend operand B, which is configured to deliver ashifted high part B′_(HIGH) 56 or shifted low part B′_(LOW) 76 of theaddend operand B. Further the arithmetic unit 10 comprises a first adder16, 36 connected to an output 15, 35 of the multiplier 14, 34 and anoutput 25, 45 of the right shifter 24, 44, which is configured todeliver a shifted first intermediate result 60 or a shifted secondintermediate result 80. The arithmetic unit 10 further comprises a leftshifter 26, 46 connected to an output 17, 37 of the first adder 16, 36,which is configured to deliver a first intermediate result 62 or asecond intermediate result 82. Further the arithmetic unit 10 comprisesa second adder 18, 38 connected to an output 27, 47 of the left shifter26 of one arithmetic unit 12 and to an output 43, 23 of a left shifter46 of the other arithmetic unit 32, wherein a carry-output 48 of thesecond adder 38 of the second arithmetic unit 32 is connected to aninput 28 of the second adder 18 of the first arithmetic unit 12. Furthera normalizing and rounding unit 20, 40 implementing a guard bit logicdevice may be comprised, connected to an output 17, 37 of the firstadder 16, 36, which may be reused for aligning the results of theshifters 26, 46. A select circuit 22, 42 may further be comprised,connected to outputs 19, 39 of the second adder 18, 38 and to outputs21, 41 of the normalizing and rounding unit 20, 40 for delivering analigned high part result 92 or an aligned low part result 94.

The left shifter 26 of the first arithmetic unit 12 is configured todeliver a low part of the first intermediate result 62 to the secondadder 38 of the second arithmetic unit 32 and the left shifter 46 of thesecond arithmetic unit 32 is configured to deliver a high part of thesecond intermediate result 82 to the second adder 18 of the firstarithmetic unit 12. Further a low part of the first intermediate result62 is used as an input of the second adder 38 of the second arithmeticunit 32 and a high part of the second intermediate result 82 is used asan input of the second adder 18 of the first arithmetic unit 12. By thisway the high part result 92 and the low part result 94 can be computedseparately by the separate arithmetic units 12, 32 by adding thecorresponding high parts of the first intermediate result 62 and thesecond intermediate results 82 as well as the low parts of the firstintermediate result 62 and the second intermediate results 82 and thecarry 28 generated by adder 38. Then advantageously the high part result92 and the low part result 94 may be concatenated for calculating theresult 90 of the multiply-add operations.

According to the present disclosure an embodiment of an arithmetic unit10 depicted in FIG. 4 as well as according to the present disclosuremethod depicted in the data flow in FIG. 1, a VMSL shift of the addend B52, 72 to the right is performed advantageously instead of a shift ofthe product 58, 78 to the left before a partial addition of the highparts or the low parts of the operands, respectively, followed by ashift of the shifted intermediate result 60, 80 back to the left beforea final addition in order to get the result 90 of the multiply-add. Bythis way the critical path through the arithmetic unit 10 for all otherinstructions is not affected. This may advantageously provide e.g. up todouble a speed over a conventional implementation of the multiply-addoperations.

The right shifter 24 of the first arithmetic unit 12 is configured toperform right shifting of the high part B_(HIGH) 52 of the addend B by gbits and the right shifter 44 of the second arithmetic unit 32 isconfigured to perform right shifting of the low part B_(LOW) 72 of theaddend B by h bits for performing the multiply-add operations accordingto the method described, with n=2^(g) and m=2^(h), as defined before

The first adder 16, 36 may be initialized with an input of zero forstarting the multiply-add operations, as the multiply-add operations isintended to calculate the addend B as an accumulated sum. Therefore aninitial value of zero for the addend B may be appropriate.

The second adder 18, 38 may be implemented as a 64-bit adder in afavourable embodiment, being foreseen to perform addition operations forhigh parts or low parts of the first and second intermediate results 62,82 only, whereas the first adder 16, 36 being implemented to deliverfull width binary numbers. Yet advantageously adders with different bitwidths may be used.

The adder 16, 36 may implement a guard-bit logic device 20, 40 forfloating-point rounding that can be reused for aligning the firstintermediate result 62 and/or the second intermediate result 82.Advantageously in the case when m equals to 2, the least significant bitof the shifted second intermediate result 80 may reuse the guard bitlogic path. By this way an existing guard-bit logic of the binaryarithmetic units 12, 32 may be reused, which means that no changes to amultiplier 14, 34 or adder 16, 36 might be necessary.

By using the two separate arithmetic units 12, 32 in the arithmetic unit10 the shifted first intermediate result 60 and the shifted secondintermediate result 80 may be generated in parallel steps.

The arithmetic unit 10 according to an embodiment of the disclosure mayadvantageously be comprised in a data processing system 210 forperforming a multiply-add operation of binary numbers P, Q, R, S, B theoperation using high parts P 50, Q 54 and low parts R 70, S 74 ofmultiplication operands A and C for calculating a result 90 as anaccumulated sum, which equals to B+n×P×Q+m×R×S, where n and m arenatural numbers.

Referring now to FIG. 5, a schematic of an example of a data processingsystem 210 is shown. Data processing system 210 is only one example of asuitable data processing system and is not intended to suggest anylimitation as to the scope of use or functionality of embodiments of thedisclosure described herein. Regardless, data processing system 210 iscapable of being implemented and/or performing any of the functionalityset forth herein above.

In data processing system 210 there is a computer system/server 212,which is operational with numerous other general purpose or specialpurpose computing system environments or configurations. Examples ofwell-known computing systems, environments, and/or configurations thatmay be suitable for use with computer system/server 212 include, but arenot limited to, personal computer systems, server computer systems, thinclients, thick clients, handheld or laptop devices, multiprocessorsystems, microprocessor-based systems, set top boxes, programmableconsumer electronics, network PCs, minicomputer systems, mainframecomputer systems, and distributed cloud computing environments thatinclude any of the above systems or devices, and the like.

Computer system/server 212 may be described in the general context ofcomputer system executable instructions, such as program modules, beingexecuted by a computer system. Generally, program modules may includeroutines, programs, objects, components, logic, data structures, and soon that perform particular tasks or implement particular abstract datatypes. Computer system/server 212 may be practiced in distributed cloudcomputing environments where tasks are performed by remote processingdevices that are linked through a communications network. In adistributed cloud computing environment, program modules may be locatedin both local and remote computer system storage media including memorystorage devices.

As shown in FIG. 5, computer system/server 212 in data processing system210 is shown in the form of a general-purpose computing device. Thecomponents of computer system/server 212 may include, but are notlimited to, one or more processors or processing units 216, a systemmemory 228, and a bus 218 that couples various system componentsincluding system memory 228 to processor 216.

Bus 218 represents one or more of any of several types of busstructures, including a memory bus or memory controller, a peripheralbus, an accelerated graphics port, and a processor or local bus usingany of a variety of bus architectures. By way of example, and notlimitation, such architectures include Industry Standard Architecture(ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA)bus, Video Electronics Standards Association (VESA) local bus, andPeripheral Component Interconnect (PCI) bus.

Computer system/server 212 typically includes a variety of computersystem readable media. Such media may be any available media that isaccessible by computer system/server 212, and it includes both volatileand non-volatile media, removable and non-removable media.

System memory 228 can include computer system readable media in the formof volatile memory, such as random access memory (RAM) 230 and/or cachememory 232. Computer system/server 212 may further include otherremovable/non-removable, volatile/non-volatile computer system storagemedia. By way of example only, storage system 234 can be provided forreading from and writing to a non-removable, non-volatile magnetic media(not shown and typically called a “hard drive”). Although not shown, amagnetic disk drive for reading from and writing to a removable,non-volatile magnetic disk (e.g., a “floppy disk”), and an optical diskdrive for reading from or writing to a removable, non-volatile opticaldisk such as a CD-ROM, DVD-ROM or other optical media can be provided.In such instances, each can be connected to bus 218 by one or more datamedia interfaces. As will be further depicted and described below,memory 228 may include at least one program product having a set (e.g.,at least one) of program modules that are configured to carry out thefunctions of embodiments of the disclosure.

Program/utility 240, having a set (at least one) of program modules 242,may be stored in memory 228 by way of example, and not limitation, aswell as an operating system, one or more application programs, otherprogram modules, and program data. Each of the operating system, one ormore application programs, other program modules, and program data orsome combination thereof, may include an implementation of a networkingenvironment. Program modules 242 generally carry out the functionsand/or methodologies of embodiments of the disclosure as describedherein.

Computer system/server 212 may also communicate with one or moreexternal devices 214 such as a keyboard, a pointing device, a display224, etc.; one or more devices that enable a user to interact withcomputer system/server 212; and/or any devices (e.g., network card,modem, etc.) that enable computer system/server 212 to communicate withone or more other computing devices. Such communication can occur viaInput/Output (I/O) interfaces 222. Still yet, computer system/server 212can communicate with one or more networks such as a local area network(LAN), a general wide area network (WAN), and/or a public network (e.g.,the Internet) via network adapter 220. As depicted, network adapter 220communicates with the other components of computer system/server 212 viabus 218. It should be understood that although not shown, other hardwareand/or software components could be used in conjunction with computersystem/server 212. Examples, include, but are not limited to: microcode,device drivers, redundant processing units, external disk drive arrays,RAID systems, tape drives, and data archival storage systems, etc.

The present disclosure may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent disclosure.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present disclosure may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present disclosure.

Aspects of the present disclosure are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of thedisclosure. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present disclosure. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

The descriptions of the various embodiments of the present disclosurehave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

1. A computer implemented method for performing multiply-add operationsof binary numbers P, Q, R, S, B in at least one arithmetic unit of aprocessor, the operation calculating a result as an accumulated sum,which equals to B+n×P×Q+m×R×S, where n and m are natural numbers, themethod comprising the calculation steps for obtaining a result of theoperation: generating, by a right shifter of the arithmetic unit, ashifted high part (B′_(HIGH)) of the addend B by performing a rightshift of the high part (B_(HIGH)) of the addend B by n bits; generating,by a first adder of the arithmetic unit connected to an output of amultiplier and the right shifter; a shifted first intermediate result bygenerating the multiplication product P×Q and adding the shifted highpart B′_(HIGH); generating, by a left shifter of the arithmetic unit, afirst intermediate result by performing a left shift of the shiftedfirst intermediate result by n bits; generating, by the right shifter ofthe arithmetic unit, shifted low part (B′_(LOW)) of the addend B byperforming a right shift of the low part (B_(LOW)) of the addend B by mbits; generating, by the left shifter, a shifted second intermediateresult by generating the multiplication product R×S and adding theshifted low part B′_(LOW); generating, by a second adder connected to anoutput of the left shifter; a second intermediate result by performing aleft shift of the shifted second intermediate result by m bits;determining, by the multiplier of the arithmetic unit, the accumulatedsum as the result of the multiply-add operations by adding the firstintermediate result to the second intermediate result; generating theshifted first intermediate result and the shifted second intermediateresult in parallel steps; and wherein the natural numbers n and m beingin the range of {1, 2}; wherein the addend B is initialized with zerofor starting the multiply-add operations; wherein a guard bit logic pathof the arithmetic unit is used for rounding an output of the firstadder, and when m equals to 2, the shifted second intermediate resultreuses part of the guard bit logic path; and wherein the preceding stepsare performed on at least two binary arithmetic units.